﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI.WebControls;
using System.Web.UI;
using System.ComponentModel;
using System.Web.UI.HtmlControls;
using System.Collections;
using Org.Eurekaa.DNJ.Helpers;
using Org.Eurekaa.DNJ.UI.Common;
using Org.Eurekaa.DNJ.UI.DNJSettings;
using Org.Eurekaa.DNJ.Settings;
using System.Drawing;


namespace Org.Eurekaa.DNJ.UI.WebControls
{
    [ToolboxBitmap(typeof(Org.Eurekaa.DNJ.UI.Resources.icons.DNJUIIcons), "DNJWebControl.bmp")]
    public abstract class JQueryUIControl : CompositeControl
    {
        public virtual void SaveSettings(ref object stateObject)
        {
            stateObject = null;
        }
        public virtual void LoadSettings(object stateObject)
        {
                

        }
        public JQueryUIControl()
        {

        }
        protected override object SaveViewState()
        {
            object[] state = new object[2];
            object baseState = base.SaveViewState();
            state[0] = baseState;
            SaveSettings(ref state[1]);

            //PageHelper.RegisterHeaderScript(Page.ClientScript.GetWebResourceUrl(typeof(Org.Eurekaa.DNJ.UI.Resources.js.DNJUIClientScripts), "Org.Eurekaa.DNJ.UI.Resources.js.dnj-ui.js"), this.Page.Header);
            return state;
        }
        protected override void LoadViewState(object savedState)
        {
            if (savedState == null) return;
            object[] state = (object[])savedState;
            base.LoadViewState(state[0]);

            if (state[1] != null && state[1] is GenericSettingsObject)
                LoadSettings(state[1]);

        }

    }
}
